home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 4.00 Begin VB.Form Form1 Caption = "First Impression Drill Down Example" ClientHeight = 6450 ClientLeft = 2295 ClientTop = 1770 ClientWidth = 9660 Height = 7140 Icon = "drill1.frx":0000 Left = 2235 LinkTopic = "Form1" ScaleHeight = 6450 ScaleWidth = 9660 Top = 1140 Width = 9780 Begin VB.Data Data1 Caption = "CPU Data" Connect = "Access" DatabaseName = "" Exclusive = 0 'False Height = 315 Left = 6300 Options = 0 ReadOnly = 0 'False RecordsetType = 2 'Snapshot RecordSource = "" Top = 5760 Visible = 0 'False Width = 3075 End Begin Threed.SSPanel pnlStatus Align = 2 'Align Bottom Height = 330 Left = 0 TabIndex = 0 Top = 6120 Width = 9660 _Version = 65536 _ExtentX = 17039 _ExtentY = 582 _StockProps = 15 Caption = "Ready" BackColor = 12632256 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty BorderWidth = 1 BevelInner = 1 Alignment = 1 End Begin VtChartLib.VtChart VtChart1 Height = 5535 Left = 120 TabIndex = 1 Top = 120 Width = 8655 _ExtentX = 15266 _ExtentY = 9763 _0 = $"drill1.frx":030A _1 = $"drill1.frx":0710 _2 = $"drill1.frx":0B15 _3 = $"drill1.frx":0F1A _4 = $"drill1.frx":131F _5 = $"drill1.frx":1724 _6 = $"drill1.frx":1B29 _7 = $"drill1.frx":1F2E _8 = $"drill1.frx":2333 _9 = $"drill1.frx":2738 _10 = $"drill1.frx":2B3D _11 = $"drill1.frx":2F42 _12 = $"drill1.frx":3347 _13 = $"drill1.frx":374C _count = 14 _ver = 1 End Begin VB.Menu mnuPreviousChart Caption = "&Previous Chart!" End Attribute VB_Name = "Form1" Attribute VB_Creatable = False Attribute VB_Exposed = False Option Explicit Dim gChartLevel%, gVendor$ Function ScaleToPercent#(value#, max&, min&) '' Scales a number fit in 0 to 100 range given the range of '' the number and the max and min of the range. '' Eg max = 48, min = 15, 48 becomes 100 and 15 becomes 100. ScaleToPercent = (value - min) * 100 / (max - min) End Function Private Sub SetupTopLevelChart() Dim rows%, cols%, i%, j% '' Fetch the data for the first query and refresh pnlStatus.Caption = " Fetching data..." pnlStatus.Refresh Data1.RecordSource = "ModelCountByVendor" Data1.Refresh '' Move the data into the chart. First size the FI DataGrid to the '' dataset. The first column goes in the first row of labels. The '' second column is the single pie's values and indicates how many '' CPUs are available from each Vendor pnlStatus.Caption = " Formatting chart..." pnlStatus.Refresh '' Load the template chart VtChart1.ReadFromFile App.Path & "\template\pie1.vtc" VtChart1.AllowSelections = True VtChart1.AllowSeriesSelection = True cols = Data1.Recordset.RecordCount VtChart1.RowCount = 1 VtChart1.ColumnCount = cols For i = 1 To cols VtChart1.Column = i VtChart1.ColumnLabel = Data1.Recordset!vendor VtChart1.DataGrid.SetData 1, i, Data1.Recordset!CountOfVendor, False Data1.Recordset.MoveNext Next i pnlStatus.Caption = " Ready..." gChartLevel = 1 End Sub Private Sub SetupSecondLevelChart(vendor$) Dim rows%, cols%, i%, j%, Series As Object '' Set a global Vendor so we can easily back up from the level 3 chart Let gVendor = vendor '' Fetch the data for the second query and refresh. This chart shows '' Performance, Cycle Time and Cache by model for the specified Vendor. '' Notice that a pair of double quotes in a string insert a double quote '' in the variable. pnlStatus.Caption = " Fetching data..." pnlStatus.Refresh Data1.RecordSource = "SELECT Model, [Relative Performance], Cache, " & _ "[Machine Cycle Time] FROM Specification WHERE Vendor = """ & vendor & _ """ ORDER BY [Relative Performance] DESC;" Data1.Refresh '' Move the data into the chart. First size the FI DataGrid to the '' dataset. The line chart is laid out like the datagrid pnlStatus.Caption = " Formatting chart..." pnlStatus.Refresh '' Load the template chart first so Form Load looks better VtChart1.ReadFromFile App.Path & "\template\line1.vtc" '' Turn series selections off since we only want data point activations VtChart1.AllowSelections = True VtChart1.AllowSeriesSelection = False rows = Data1.Recordset.RecordCount '' Show markers if there is only one model since a line chart '' can't draw a line between one point. This doesn't need to '' be reset since the chart template will reset it. If rows = 1 Then For Each Series In VtChart1.Plot.SeriesCollection Series.SeriesMarker.Show = True Next Series End If VtChart1.Title = "Performance and Key Indicators for " & vendor & " Models" VtChart1.RowCount = rows VtChart1.ColumnCount = 3 With Data1.Recordset For i = 1 To rows VtChart1.Row = i VtChart1.RowLabel = !model VtChart1.DataGrid.SetData i, 1, ![Relative Performance], False VtChart1.DataGrid.SetData i, 2, !cache, False VtChart1.DataGrid.SetData i, 3, ![Machine Cycle Time], False .MoveNext Next i End With pnlStatus.Caption = " Ready..." gChartLevel = 2 End Sub Private Sub SetupThirdLevelChart(vendor$, model$) Dim rp#, ep#, cache#, maxMem#, minMem#, maxChan#, minChan#, cycleTime# '' Fetch the data for the third query and refresh. This chart shows '' all specifications for the specified Vendor and model. These are '' displayed in a radar chart where all stats are normalized to a 0-100 '' scale according to a max and min for a given parameter. This makes the '' radar chart purely relative to the data set. pnlStatus.Caption = " Fetching data..." pnlStatus.Refresh '' First get the stats for the selected model Data1.RecordSource = "SELECT * FROM specification WHERE Vendor = """ & _ vendor & """ AND Model = """ & model & """;" Data1.Refresh With Data1.Recordset rp = ![Relative Performance] ep = ![Estimated Performance] cache = !cache cycleTime = ![Machine Cycle Time] maxMem = ![Max Main Memory] minMem = ![Min Main Memory] maxChan = ![Max Channels] minChan = ![Min Channels] End With '' Now get the max and min for all parameters for scaling this '' models values Data1.RecordSource = "ParameterMaxMin" Data1.Refresh With Data1.Recordset rp = ScaleToPercent(rp, !MaxRP, !MinRP) ep = ScaleToPercent(ep, !MaxEP, !MinEP) maxMem = ScaleToPercent(maxMem, !MaxMaxMem, !MinMaxMem) minMem = ScaleToPercent(minMem, !MaxMinMem, !MinMinMem) maxChan = ScaleToPercent(maxChan, !MaxMaxChan, !MinMaxChan) minChan = ScaleToPercent(minChan, !MaxMinChan, !MinMinChan) cache = ScaleToPercent(cache, !MaxCache, !MinCache) cycleTime = ScaleToPercent(cycleTime, !MaxCT, !MinCT) End With '' Move the data into the chart. First size the FI DataGrid to the '' dataset. The line chart is laid out like the datagrid pnlStatus.Caption = " Formatting chart..." pnlStatus.Refresh '' Load the template chart VtChart1.ReadFromFile App.Path & "\template\radar1.vtc" VtChart1.Title = "Normalized Performance Indicators for " & vendor & " " & model VtChart1.AllowSelections = False 'Exit Sub With VtChart1.DataGrid .SetData 1, 1, rp, False .SetData 2, 1, ep, False .SetData 3, 1, maxMem, False .SetData 4, 1, minMem, False .SetData 5, 1, maxChan, False .SetData 6, 1, minChan, False .SetData 7, 1, cache, False .SetData 8, 1, cycleTime, False End With pnlStatus.Caption = " Ready..." gChartLevel = 3 End Sub Private Sub Form_Load() gChartLevel = 1 Data1.DatabaseName = App.Path & "\machine.mdb" SetupTopLevelChart End Sub Private Sub Form_Resize() '' Repaint is set to False to stop multiple '' paints for a single resize event With VtChart1 .Repaint = False .Width = ScaleWidth .Height = ScaleHeight - pnlStatus.Height .Repaint = True End With End Sub Private Sub mnuPreviousChart_Click() Select Case gChartLevel Case 2 SetupTopLevelChart Case 3 SetupSecondLevelChart gVendor End Select End Sub Private Sub VtChart1_AxisLabelSelected(AxisId As Integer, AxisIndex As Integer, labelSetIndex As Integer, LabelIndex As Integer, MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_AxisSelected(AxisId As Integer, AxisIndex As Integer, MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_AxisTitleSelected(AxisId As Integer, AxisIndex As Integer, MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_ChartSelected(MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_FootnoteSelected(MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_LegendSelected(MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_PlotSelected(MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_PointActivated(Series As Integer, DataPoint As Integer, MouseFlags As Integer, Cancel As Integer) Cancel = True If gChartLevel = 2 Then VtChart1.Row = DataPoint SetupThirdLevelChart gVendor, VtChart1.RowLabel End If End Sub Private Sub VtChart1_PointLabelSelected(Series As Integer, DataPoint As Integer, MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_SeriesActivated(Series As Integer, MouseFlags As Integer, Cancel As Integer) Cancel = True If gChartLevel = 1 Then SetupSecondLevelChart VtChart1.Plot.SeriesCollection.Item(Series).SeriesLabel.Text End If End Sub Private Sub VtChart1_SeriesLabelSelected(Series As Integer, MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub Private Sub VtChart1_TitleSelected(MouseFlags As Integer, Cancel As Integer) Cancel = True End Sub